import http from './request';

// orderList 查询订单
const orderList = (params: any): PRES<orderList> => http.get('order/list', { params });

// 获取订单详情
const orderId = (id: any): PRES<Orderdetails> => http.get(`order/${id}`)

// 获取订单设置 /orderSetting/{id} 
const orderSetting = (id: number): PRES<orderSettingList> => http.get(`orderSetting/${id}`)

// /orderSetting/update/{id}
const orderSettingUpdate = (params: any): PRES<orderSettingList> => http.post(`orderSetting/update/${params.id}`, params)


// 分页查询退货申请 returnApply/list
const returnApplyList = (params: any): PRES<orderList> => http.get(`returnApply/list`, { params })

// 退货详情页 /returnApply/{id}
const returnApplyDetails = (id: number) => http.get(`/returnApply/${id}`)

// order/delete 批量删除订单
const orderDelete = (ids: number[]): PRES<number> => http.post(`order/delete?ids=${ids}`)

// /returnApply/delete 批量删除退货申请
const returnApplyDelete = (ids: number[]): PRES<number> => http.post(`returnApply/delete?ids=${ids}`)

// order/update/close 批量关闭订单
const updateClose = (ids: number, note: string): PRES<number> => http.post(`order/update/close?ids=${ids}&note=${note}`)

export {
    orderList,
    orderId,
    orderSetting,
    returnApplyList,
    returnApplyDetails,
    orderSettingUpdate,
    orderDelete,
    updateClose,
    returnApplyDelete
}